package com.tingyuge.base.thread.wang.chapter9;

/**
 * Created by xiaodao
 * date: 2019/11/29
 */
public class ThreadGroupApi2 {

    public static void main(String[] args) throws InterruptedException {



        ThreadGroup g1 = new ThreadGroup("g1");

        Thread t1 = new Thread(g1,"t1"){
            @Override
            public void run() {
                    try {
                        Thread.sleep(1_000);
                    } catch (InterruptedException e) {
                        System.out.println("--11-");
                        e.printStackTrace();
                }
            }
        };
        //最后一个线程执行结束会自动的回收
        g1.setDaemon(true);
        t1.start();
        Thread.sleep(2_000);
        System.out.println(g1.isDestroyed());

    }
}
